<template>
    <el-dialog
            :title="title"
            :visible.sync="localVisible"
            v-on:opened="$emit('opened')"
            v-on:closed="$emit('closed')"
            width="30%">
        <slot></slot>
        <IiFrame ref="iiframe" :url="url"></IiFrame>
        <span slot="footer" class="dialog-footer">
    <el-button @click="localVisible = false">取 消</el-button>
    <el-button type="primary" @click="refresh()">刷新</el-button>
  </span>
    </el-dialog>
</template>

<script>
    import IiFrame from './IiFrame.vue'
    export default {
        components: {
            IiFrame
        },
        props: {
            url: {
                type: String,
                required: true
            },
            visible: {
                type: Boolean,
                default: false
            },
            title:{
                type: String,
                default: '内容信息'
            }
        },
        data() {
            return {
                localVisible: this.visible
            }
        },
        mounted(){
        },
        methods:{
            show(){
                this.localVisible = true
            },
            hide(){
                this.localVisible = false
            },
            refresh(){
                this.$refs.iiframe.refresh()
            }
        },
        watch:{
            visible(val){
                this.localVisible = val
            }
        }
    }
</script>

<style scoped>

</style>